import React from 'react';
import { View } from '@tarojs/components';
import './index.less';

type FieldProps = {
  title?: string;
  children: React.ReactNode;
}

function Field(props: FieldProps) {
  const { title } = props;

  return (
    <View className='at-input at-input--without-border'>
      <View className='at-input__container'>
        {
          !!title && <View className='field-title at-input__title'>{title}</View>
        }
        <View className='field-body'>
          {props.children}
        </View>
      </View>
    </View>
  );
}

export default Field;
